<?php
/**
 * Single post/page options admin tab
 *
 * @package itx_themes
 */

if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
extract(itx_get_option('single'));?>

<div id="itx-single">
<h3>Post Meta</h3>
Meta info to show in each post.
<input type="hidden" name="<?php echo get_template();?>_single[post_meta][opt]" value="1" />
<?php
$i=0;
foreach (itx_setting('post_meta') as $k => $v ){
	if (!empty($v)){
		if (is_array($v)){
			echo "<table class='form-table'><tr><th>Show in the $k</th><td>";
			itx_form_radios(array('None')+$v,"single[post_meta][$i]",$post_meta[$i],false);
			echo '</td></tr></table>';
		} else{
			$checked=(isset($post_meta[$i])&&$post_meta[$i]==$k)?'checked="checked"':'';
			echo '<table class="form-table"><tr><th>Show '.$v.'</th>
			<td><input type="checkbox" name="'.get_template().'_single[post_meta]['.$i.']" value="'.$k.'" '.$checked.' /></td></tr></table>';
		}
	}
	$i++;
}
?>
<hr />
<h3>Page Meta</h3>
Meta info to show in each page.
<input type="hidden" name="<?php echo get_template();?>_single[page_meta][opt]" value="1" />
<?php
$i=0;
foreach (itx_setting('page_meta') as $k => $v ){
	if (!empty($v)){
		if (is_array($v)){
			echo "<table class='form-table'><tr><th>Show in the $k</th><td>";
			itx_form_radios(array('None')+$v,"single[page_meta][$i]",$page_meta[$i],false);
			echo '</td></tr></table>';
		} else{
			$checked=(isset($page_meta[$i])&&$page_meta[$i]==$k)?'checked="checked"':'';
			echo '<table class="form-table"><tr><th>Show '.$v.'</th>
			<td><input type="checkbox" name="'.get_template().'_single[page_meta]['.$i.']" value="'.$k.'" '.$checked.' /></td></tr></table>';
		}
	}
	$i++;
}
?>

<div class="clear"></div>
<?php do_action('itx_admin_single');?>
<button type="submit" name="<?php echo get_template();?>_reset" class="button-secondary"  value="single" onclick="if (!confirm('Do you want to reset Single Post/Page Options to Default?')) return false;">Reset to default Single Post/Page Options</button>
</div>